package cn.ad.server.domain.ad;

import cn.ad.server.domain.ad.vo.AdSpaceVO;
import cn.ad.server.domain.ad.vo.CampaignVO;
import cn.ad.server.domain.ad.vo.StrategyGroupVO;
import cn.ad.server.domain.ad.vo.StrategyVO;
import com.baidu.bjf.remoting.protobuf.FieldType;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * 增删字段的时候，所有字段上的order数值不能做更改，只能顺延
 * 
 * @author alleywind
 *
 */
public class GuidValueObject {

	public static final int CURRENT_VERSION = 2;

	@Protobuf(order = 1)
	private String guid;

	@Protobuf(order = 2)
	private long aid;

	@Protobuf(order = 3)
	private long sid;

	@Protobuf(order = 4)
	private long cid;

	@Protobuf(order = 5)
	private long mid;

	@Protobuf(order = 6)
	private int fid;

	@Protobuf(order = 7)
	private int templateId;

	@Protobuf(order = 8)
	private String muniqueId;

	@Protobuf(order = 9)
	private int muniqueType;

	@Protobuf(order = 10)
	private int deviceType;

	@Protobuf(order = 11)
	private String brand;

	@Protobuf(order = 12)
	private int os;

	@Protobuf(order = 13)
	private String platform;

	@Protobuf(order = 14)
	private String deviceSize;

	@Protobuf(order = 15)
	private int network;

	@Protobuf(order = 16)
	private int operator;

	@Protobuf(order = 17)
	private String ip;

	@Protobuf(order = 18)
	private float longitude;

	@Protobuf(order = 19)
	private float latitude;

	@Protobuf(order = 20)
	private String mac;

	@Protobuf(order = 21)
	private String mac1;

	@Protobuf(order = 22)
	private String imei;

	@Protobuf(order = 23)
	private String anid;

	@Protobuf(order = 24)
	private String aaid;

	@Protobuf(order = 25)
	private String idfa;

	@Protobuf(order = 26)
	private String udid;

	@Protobuf(order = 27)
	private String duid;

	@Protobuf(order = 28)
	private String imeisha1;

	// idfa的sha1
	@Protobuf(order = 29)
	private String dpidsha1;

	@Protobuf(order = 30)
	private String macsha1;

	@Protobuf(order = 31)
	private String imeimd5;

	// idfa的md5
	@Protobuf(order = 32)
	private String dpidmd5;

	@Protobuf(order = 33)
	private String macmd5;

	@Protobuf(order = 34)
	private String customId;

	@Protobuf(order = 35)
	private String openUdid;

	@Protobuf(order = 36)
	private int campaignId;

	@Protobuf(order = 37)
	public int serializeVersion;

	@Protobuf(order = 38, fieldType = FieldType.OBJECT)
	private AdSpaceVO adSpaceVO;

	@Protobuf(order = 39, fieldType = FieldType.OBJECT)
	private StrategyVO strategyVO;

	@Protobuf(order = 40, fieldType = FieldType.OBJECT)
	private StrategyGroupVO strategyGroupVO;

	@Protobuf(order = 41, fieldType = FieldType.OBJECT)
	private CampaignVO campaignVO;
	
	/**
	 * 
	 * @return
	 * @deprecated 代码重构整理，将缓存相关处理方法移植到持久化层完成，参见{@link cn.falconnect.adserver.persistence.GuidRepository#buildCachekey}
	 */
	@Deprecated
	public String toGUIDKey() {
		StringBuffer sb = new StringBuffer("guid:");
		sb.append(CURRENT_VERSION).append(":").append(this.getGuid());
		return sb.toString();
	}
	/**
	 * @deprecated 代码重构整理，将缓存相关处理方法移植到持久化层完成，参见{@link cn.falconnect.adserver.persistence.GuidRepository#buildCachekey}
	 */
	@Deprecated
	public static String toGUIDKey(String guid) {
		StringBuffer sb = new StringBuffer("guid:");
		sb.append(CURRENT_VERSION).append(":").append(guid);
		return sb.toString();
	}
	
	/**
	 * 
	 * @return
	 * @deprecated 代码重构整理，将缓存相关处理方法移植到持久化层完成，参见{@link cn.falconnect.adserver.persistence.GuidRepositoryImpl#buildCountClickCacheKey}
	 */
	@Deprecated
	public String countClickKey() {
		return new StringBuilder(this.guid).append(":").append("click").append(":").append("count").toString();
	}

	/**
	 * 
	 * @return
	 * @deprecated 代码重构整理，将缓存相关处理方法移植到持久化层完成，参见{@link cn.falconnect.adserver.persistence.GuidRepositoryImpl#buildCountImpressionsCacheKey}
	 */
	@Deprecated
	public String countImpressionsKey() {
		return new StringBuilder(this.guid).append(":").append("impressions").append(":").append("count").toString();
	}

	/**
	 * 
	 * @return
	 * @deprecated 代码重构整理，将缓存相关处理方法移植到持久化层完成，参见{@link cn.falconnect.adserver.persistence.GuidRepositoryImpl#buildCountClickTimeCacheKey}
	 */
	@Deprecated
	public String countClickTimeKey() {
		return new StringBuilder(this.guid).append(":").append("click").append(":").append("count").append(":")
				.append("time").toString();
	}

	/**
	 * 
	 * @return
	 * @deprecated 代码重构整理，将缓存相关处理方法移植到持久化层完成，参见{@link cn.falconnect.adserver.persistence.GuidRepositoryImpl#buildCountImpressionsTimeKey}
	 */
	@Deprecated
	public String countImpressionsTimeKey() {
		return new StringBuilder(this.guid).append(":").append("impressions").append(":").append("count").append(":")
				.append("time").toString();
	}

	public AdSpaceVO getAdSpaceVO() {
		return adSpaceVO;
	}

	public void setAdSpaceVO(AdSpaceVO adSpaceVO) {
		this.adSpaceVO = adSpaceVO;
	}

	public StrategyVO getStrategyVO() {
		return strategyVO;
	}

	public void setStrategyVO(StrategyVO strategyVO) {
		this.strategyVO = strategyVO;
	}

	public StrategyGroupVO getStrategyGroupVO() {
		return strategyGroupVO;
	}

	public void setStrategyGroupVO(StrategyGroupVO strategyGroupVO) {
		this.strategyGroupVO = strategyGroupVO;
	}

	public CampaignVO getCampaignVO() {
		return campaignVO;
	}

	public void setCampaignVO(CampaignVO campaignVO) {
		this.campaignVO = campaignVO;
	}

	public String getGuid() {
		return guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	public long getAid() {
		return aid;
	}

	public void setAid(long aid) {
		this.aid = aid;
	}

	public long getSid() {
		return sid;
	}

	public void setSid(long sid) {
		this.sid = sid;
	}

	public long getCid() {
		return cid;
	}

	public void setCid(long cid) {
		this.cid = cid;
	}

	public long getMid() {
		return mid;
	}

	public void setMid(long mid) {
		this.mid = mid;
	}

	public String getMuniqueId() {
		return muniqueId;
	}

	public void setMuniqueId(String muniqueId) {
		this.muniqueId = muniqueId;
	}

	public int getMuniqueType() {
		return muniqueType;
	}

	public void setMuniqueType(int muniqueType) {
		this.muniqueType = muniqueType;
	}

	public int getDeviceType() {
		return deviceType;
	}

	public void setDeviceType(int deviceType) {
		this.deviceType = deviceType;
	}

	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public int getOs() {
		return os;
	}

	public void setOs(int os) {
		this.os = os;
	}

	public String getPlatform() {
		return platform;
	}

	public void setPlatform(String platform) {
		this.platform = platform;
	}

	public String getDeviceSize() {
		return deviceSize;
	}

	public void setDeviceSize(String deviceSize) {
		this.deviceSize = deviceSize;
	}

	public int getNetwork() {
		return network;
	}

	public void setNetwork(int network) {
		this.network = network;
	}

	public int getOperator() {
		return operator;
	}

	public void setOperator(int operator) {
		this.operator = operator;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public float getLongitude() {
		return longitude;
	}

	public void setLongitude(float longitude) {
		this.longitude = longitude;
	}

	public float getLatitude() {
		return latitude;
	}

	public void setLatitude(float latitude) {
		this.latitude = latitude;
	}

	public String getMac() {
		return mac;
	}

	public void setMac(String mac) {
		this.mac = mac;
	}

	public String getMac1() {
		return mac1;
	}

	public void setMac1(String mac1) {
		this.mac1 = mac1;
	}

	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}

	public String getAnid() {
		return anid;
	}

	public void setAnid(String anid) {
		this.anid = anid;
	}

	public String getAaid() {
		return aaid;
	}

	public void setAaid(String aaid) {
		this.aaid = aaid;
	}

	public String getIdfa() {
		return idfa;
	}

	public void setIdfa(String idfa) {
		this.idfa = idfa;
	}

	public String getUdid() {
		return udid;
	}

	public void setUdid(String udid) {
		this.udid = udid;
	}

	public String getDuid() {
		return duid;
	}

	public void setDuid(String duid) {
		this.duid = duid;
	}

	public String getOpenUdid() {
		return openUdid;
	}

	public void setOpenUdid(String openUdid) {
		this.openUdid = openUdid;
	}

	public int getFid() {
		return fid;
	}

	public void setFid(int fid) {
		this.fid = fid;
	}

	public String getImeisha1() {
		return imeisha1;
	}

	public void setImeisha1(String imeisha1) {
		this.imeisha1 = imeisha1;
	}

	public String getDpidsha1() {
		return dpidsha1;
	}

	public void setDpidsha1(String dpidsha1) {
		this.dpidsha1 = dpidsha1;
	}

	public String getMacsha1() {
		return macsha1;
	}

	public void setMacsha1(String macsha1) {
		this.macsha1 = macsha1;
	}

	public String getImeimd5() {
		return imeimd5;
	}

	public void setImeimd5(String imeimd5) {
		this.imeimd5 = imeimd5;
	}

	public String getDpidmd5() {
		return dpidmd5;
	}

	public void setDpidmd5(String dpidmd5) {
		this.dpidmd5 = dpidmd5;
	}

	public String getMacmd5() {
		return macmd5;
	}

	public void setMacmd5(String macmd5) {
		this.macmd5 = macmd5;
	}

	public String getCustomId() {
		return customId;
	}

	public void setCustomId(String customId) {
		this.customId = customId;
	}

	public int getTemplateId() {
		return templateId;
	}

	public void setTemplateId(int templateId) {
		this.templateId = templateId;
	}

	public int getCampaignId() {
		return campaignId;
	}

	public void setCampaignId(int campaignId) {
		this.campaignId = campaignId;
	}

	public int getSerializeVersion() {
		return serializeVersion;
	}

	public void setSerializeVersion(int serializeVersion) {
		this.serializeVersion = serializeVersion;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
